package com.gym.controller;

import com.gym.client.CourseClient;
import com.gym.client.TrainClient;
import com.gym.pojo.Personaltrainer;
import com.gym.pojo.Train;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
public class TrainController {
    @Resource
    private TrainClient client;
    @Resource
    private CourseClient courseClient;
    @RequestMapping("selectycx")
    public boolean selectycx(String trainname){
        return client.selectycx(trainname);
    }
    @RequestMapping("/insertsjd")
    public boolean insertsjd(Personaltrainer personaltrainer){
        return client.insertsjd(personaltrainer);
    }
    @RequestMapping("/selectsj")
    public List<Train> selectsj(String username){
        return client.selectsj(username);
    }
    @RequestMapping("/insertjl")
    public boolean insertjl(Train train){
        return client.insertjl(train);
    }
    @RequestMapping("/updatejl")
    public boolean updatejl(Train train){
        return client.updatejl(train);
    }
    @RequestMapping("/deletejl")
    public boolean deletejl(int trainid){
        boolean r2=courseClient.delCourseByCoachId(trainid);
        return client.deletejl(trainid);
    }
    @RequestMapping("/selectid")
    public Train selectid(int trainid){
        return client.selectid(trainid);
    }
    @RequestMapping("/selectjl")
    public Map<String, Object> selectjl(String trainname,int page,int limit){
        return client.selectjl(trainname,page,limit);
    }
    @RequestMapping("/deletesjs")
    public boolean deletesjs(int personalId){
        return client.deletesjs(personalId);
    }
    @RequestMapping("selectsjd")
    public List<Train> selectsjd(){
        return client.selectsjd();
    }
    @RequestMapping("/deletesj")
    public boolean deletesj(int trainid){
        return client.deletesj(trainid);
    };
}
